﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.ViewModel;
using Sautom.ClientComunication;
using Sautom.ClientComunication.Commands;
using Sautom.ClientComunication.Services;
using Sautom.Modules.Authorization.Commands;

namespace Sautom.Modules.Authorization.ViewModels
{
    public class ChangePasswordViewModel : NotificationObject
    {
        #region Constructors
        public ChangePasswordViewModel(IRegionManager regionManager, AuthorizationService authorizationService)
        {
            ProccessChangePasswordCommand = new ProccessChangePasswordCommand(authorizationService, regionManager, this);
            ToLoginCommand = new SimpleNavigateCommand(regionManager, RegionProvider.MainRegion, PathProvider.Login);
        }
        #endregion

        #region Commands
        public ICommand ProccessChangePasswordCommand { get; set; }
        public ICommand ToLoginCommand { get; set; }
        #endregion

        #region View model properties
        private string _userName;
        public string UserName
        {
            get { return _userName; }
            set
            {
                _userName = value;
                RaisePropertyChanged(() => UserName);
            }
        }

        private string _password;
        public string Password
        {
            get { return _password; }
            set
            {
                _password = value;
                RaisePropertyChanged(() => Password);
            }
        }

        private string _newPassword;
        public string NewPassword
        {
            get { return _newPassword; }
            set
            {
                _newPassword = value;
                RaisePropertyChanged(() => NewPassword);
            }
        }

        private bool _hasError;
        public bool HasError
        {
            get { return _hasError; }
            set 
            {
                _hasError = value;
                RaisePropertyChanged(() => HasError);
            }
        }

        #endregion
    }
}
